/*
 * Created on 2005-1-25
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.nauu.atombuilder.util;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gef.requests.SimpleFactory;
import org.eclipse.jface.resource.ImageDescriptor;

import com.nauu.atombuilder.AtomBuilderPlugin;
import com.nauu.atombuilder.modle.Colbar;
import com.nauu.atombuilder.modle.Grid;
import com.nauu.atombuilder.modle.TextField;

/**
 * @author nauu
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class FormPaletteFactory {
    public static PaletteRoot createPalette() {
        PaletteRoot paletteRoot = new PaletteRoot();
        paletteRoot.addAll(createCategories(paletteRoot));
        return paletteRoot;
    }

    private static List createCategories(PaletteRoot root) {
        List categories = new ArrayList();

        categories.add(createComponentsDrawer());

        return categories;
    }


    private static PaletteContainer createComponentsDrawer() {

        PaletteDrawer drawer = new PaletteDrawer("Components");

        List entries = new ArrayList();
        
        ToolEntry Col = new CombinedTemplateCreationEntry("Colbar", "Create a new Colbar", Grid.class, new SimpleFactory(
        		Colbar.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);

        ToolEntry Text = new CombinedTemplateCreationEntry("Text", "Create a new Grid", Grid.class, new SimpleFactory(
        		TextField.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);

        ToolEntry Checkbox = new CombinedTemplateCreationEntry("Checkbox", "Create a new Grid", Grid.class, new SimpleFactory(
        		TextField.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry Radio = new CombinedTemplateCreationEntry("Radio", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry Combo = new CombinedTemplateCreationEntry("Combo", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry DatePicker = new CombinedTemplateCreationEntry("DatePicker", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry Label = new CombinedTemplateCreationEntry("Label", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry Textarea = new CombinedTemplateCreationEntry("Textarea", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry HtmlEditor = new CombinedTemplateCreationEntry("HtmlEditor", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry File = new CombinedTemplateCreationEntry("File", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry TextPlus = new CombinedTemplateCreationEntry("TextPlus", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        ToolEntry Button = new CombinedTemplateCreationEntry("Button", "Create a new Grid", Grid.class, new SimpleFactory(
        		Grid.class), ImageDescriptor.createFromFile(AtomBuilderPlugin.class,"icons/grid.png"), null);
        
        entries.add(Col);
        entries.add(Text);
        entries.add(Checkbox);
        entries.add(Radio);
        entries.add(Combo);
        entries.add(DatePicker);
        entries.add(Label);
        entries.add(Textarea);
        entries.add(HtmlEditor);
        entries.add(File);
        entries.add(TextPlus);
        entries.add(Button);

        drawer.addAll(entries);
        return drawer;
    }
}